﻿using System;

namespace Tambourine.Model
{
    /// <summary>
    /// Presents a single test result
    /// (single result cell in pivot table)
    /// </summary>
    public class TestResult : IComparable
    {
        public bool IsSuccessful {get; set;}
        public bool WasExecuted { get; set; }
        public string FailureMesssage { get; set; }
        public string FailureStackTrace { get; set; }

        public override string ToString()
        {
            return IsSuccessful.ToString();
        }

        #region IComparable
        public int CompareTo(object obj)
        {
            if (obj == null) return 1;

            TestResult otherTestResult = obj as TestResult;
            if (otherTestResult != null)
                return this.IsSuccessful.CompareTo(otherTestResult.IsSuccessful);
            else
                throw new ArgumentException("Object is not a TestResult");
        }
        #endregion IComparable
    }
}
